package com.fjnldx.ks.mapper;

import com.fjnldx.ks.pojo.domain.*;
import com.fjnldx.ks.pojo.request.GydReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface MesSecondMapper {
    // 查询所有组织
    @Select("select * from organization")
    public List<Organization> getAllOrg();

    // 查询所有车间
    @Select("select * from mes_cejian")
    public List<CeJian> getAllWorkShop();

    // 查询所有工序
    @Select("select * from mes_gongxu")
    public List<GongXu> getAllGongXu();

    // 查询所有设备类型
    @Select("select * from equipment")
    public List<Equipment> getAllEquipment();
    // 查询所有品种名称
    @Select("select * from mes_pinzhong")
    public List<Pz> getAllPz();
    // 查询工艺单模板
    @Select(" <script> SELECT *"+
            "from process_sheet" +
            " WHERE " +
            "1=1"+
            "<if test=\"specnum!=null\">and specnum = #{specnum} </if> "+
            " <if test=\"org!=null\">and org = #{org} </if> "+
            " <if test=\"workshop!=null\">and workshop = #{workshop} </if> "+
            " <if test=\"gongxu!=null\">and gongxu = #{pa.gongxu} </if> "+
            " <if test=\"equipment!=null\">and equipment = #{equipment} </if> "+
            " <if test=\"cur_vart!=null\">and cur_vart = #{cur_vart} </if> "+
            " limit #{page},#{size}</script>")
    public List<ProcessSheet> getProcessSheet(GydReq gydReq);
}
